package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.Function;

public interface FunctionDao extends PagingAndSortingRepository<Function, Long>,JpaSpecificationExecutor<Function> {
	@Query("select f from Function f where f.status = ?1 order by idx")
	List<Function> findByStatus(String status);
	
	@Modifying
	@Query("select f from Function f where f.restype != ?1 and f.status = ?2")
	List<Function> findMenu(short restype, String status);
}
